//package com.inspur.edp.cef.generator.coreGenerator.base.serializer;
//
//import com.fasterxml.jackson.databind.DeserializationContext;
//import com.fasterxml.jackson.databind.JsonNode;
//import com.fasterxml.jackson.databind.node.TreeTraversingParser;
//import com.inspur.edp.bef.bizentity.GspBusinessEntity;
//import com.inspur.edp.caf.generator.baseInfo.ParameterInfo;
//import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
//import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
//import com.inspur.edp.caf.generator.utils.ExpressionUtils;
//import com.inspur.edp.cef.designtime.api.IGspCommonField;
//import com.inspur.edp.cef.designtime.api.collection.GspFieldCollection;
//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.CefDataTypeImplGeneratorContext;
//import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.serializer.CMChangeJsonConvertorGenUtils;
//import com.inspur.edp.cef.generator.overall.CefGeneratorContext;
//import com.inspur.edp.cef.generator.overall.GenUtils;
//import com.inspur.edp.cef.generator.overall.Utils;
//import com.inspur.edp.cef.spi.jsonser.abstractcefchange.BefDateSerUtil;
//import com.inspur.edp.cef.spi.jsonser.base.StringUtils;
//import com.inspur.edp.cef.spi.jsonser.util.SerializerUtil;
//import com.inspur.edp.das.commonmodel.IGspCommonElement;
//import com.inspur.edp.das.commonmodel.IGspCommonObject;
//
//import java.math.BigDecimal;
//import java.util.Date;
//import java.util.HashMap;
//
//import com.inspur.edp.udt.designtime.api.entity.UnifiedDataTypeDef;
//import lombok.var;
//import org.eclipse.jdt.core.dom.*;
//import org.eclipse.jdt.core.dom.InfixExpression.Operator;
//import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
//
//
//public class ReadAssociationGenerator extends ClassMethodGenerator {
//    private static final String ParamValue = "assoValue";
//    private static final String ParamReader = "reader";
//    private static final String ParamSerializer = "serializer";
//    private static final String AssoValName = "info";
//    private static final String DicValName = "dic";
//    private static final String DicKeyValName = "dicKey";
//    private static final String PropValName = "propertyValue";
//    private IGspCommonField element;
//    private CefDataTypeImplGeneratorContext dataTypeGenContext;
//    private IGspCommonField refElement;
//
//    public ReadAssociationGenerator(
//            IGspCommonField element, CefDataTypeImplGeneratorContext dataTypeGenContext) {
//        this.element = element;
//        this.dataTypeGenContext = dataTypeGenContext;
//        this.dataTypeGenContext
//                .getAssociationReadMetdNames()
//                .put(element.getLabelID(), getMethodName());
//        refElement = getRefElement(element);
//    }
//
//    @Override
//    protected final String getMethodName() {
//        return "Read" + element.getLabelID() + "Association";
//    }
//
//    @Override
//    protected TypeInfo getReturnType() {
//        return new TypeInfo(Object.class.getName());
//    }
//
//    @Override
//    protected java.util.ArrayList<ModifierKeyword> getAccessModifiers() {
//        return new java.util.ArrayList<ModifierKeyword>(
//                java.util.Arrays.asList(new ModifierKeyword[]{ModifierKeyword.PRIVATE_KEYWORD}));
//    }
//
//    @Override
//    protected java.util.ArrayList<ParameterInfo> getParameterCollection() {
//        ParameterInfo tempVar = new ParameterInfo();
//        tempVar.setParamType(new TypeInfo(com.fasterxml.jackson.core.JsonParser.class));
//        tempVar.setParamName(ParamReader);
////    ParameterInfo tempVar2 = new ParameterInfo();
////    tempVar2.setParamType(new TypeInfo(Object.class.getName()));
////    tempVar2.setParamName(ParamValue);
//        ParameterInfo tempVar3 = new ParameterInfo();
//        tempVar3.setParamType(new TypeInfo(DeserializationContext.class));
//        tempVar3.setParamName(ParamSerializer);
//        return new java.util.ArrayList<ParameterInfo>(
//                java.util.Arrays.asList(new ParameterInfo[]{tempVar,
//                        //tempVar2,
//                        tempVar3}));
//    }
//
//    // var info = new XXInfo();
//    // Dictionary<string, object> dic = ReadAssociationValue(propertyValue);
//    // foreach (var dicKey in dic.Keys)
//    // {
//    //    if (dicKey == "Code" || dicKey == "code")
//    //        info.getCode() = dic[dicKey];
//    //    if (dicKey == "Udt" || dicKey == "udt")
//    //        info.Udt = GetUdtEntity(dic[dicKey], "configId") as IUdt;
//    //    if (dicKey == "Asso" || dicKey == "asso")
//    //        info.Asso = ReadXXXXAsso(dic[dicKey]);
//    // }
//    // return info;
//    @Override
//    protected Block buildMethodBody() {
//        java.util.ArrayList<org.eclipse.jdt.core.dom.Statement> statements =
//                new java.util.ArrayList<org.eclipse.jdt.core.dom.Statement>();
//        statements.add(getInitStatement());
//        statements.add(getDicInitStatement());
//        statements.add(getForEachStatement());
//        statements.add(getReturnStatement());
//        Block block = ast.newBlock();
//        block.statements().addAll(statements);
//        return block;
//    }
//
//    private ReturnStatement getReturnStatement() {
//        ReturnStatement returnStatement = ast.newReturnStatement();
//        returnStatement.setExpression(ast.newSimpleName(AssoValName));
//        return returnStatement;
//    }
//
//    protected VariableDeclarationStatement getInitStatement() {
//        TypeInfo assTypeSyntax;
//        if (element.getIsRefElement()) {
//            assTypeSyntax =
//                    Utils.getRefElementTypeSyntax(
//                            dataTypeGenContext.coreGenContext.getCefGenContext(), refElement);
//        } else {
//            assTypeSyntax = new TypeInfo(SerItemGenUtil.getAssociationTypeName(element));
//            assTypeSyntax.setTypePackageName(
//                    dataTypeGenContext.dataType.getGeneratedEntityClassInfo().getClassNamespace());
//        }
//
//        addImport(assTypeSyntax.getTypeFullName());
//        VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
//        fragment.setName(ast.newSimpleName(AssoValName));
//        ClassInstanceCreation instanceStatement = ast.newClassInstanceCreation();
//        instanceStatement.setType(assTypeSyntax.getType(ast));
//        fragment.setInitializer(instanceStatement);
//        VariableDeclarationStatement variableDeclarationStatement =
//                ast.newVariableDeclarationStatement(fragment);
//        variableDeclarationStatement.setType(assTypeSyntax.getType(ast));
//        return variableDeclarationStatement;
//    }
//
//    private VariableDeclarationStatement getDicInitStatement() {
//        ParameterizedType hashMapType =
//                ast.newParameterizedType(ast.newSimpleType(ast.newSimpleName("HashMap")));
//        hashMapType.typeArguments().add(ast.newSimpleType(ast.newSimpleName("String")));
//        hashMapType.typeArguments().add(ast.newSimpleType(ast.newSimpleName("Object")));
//        VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
//        fragment.setName(ast.newSimpleName(DicValName));
//        addImport(HashMap.class.getTypeName());
//
//        MethodInvocation readAssoValueInvocation = ast.newMethodInvocation();
//        readAssoValueInvocation.setName(ast.newSimpleName("readAssociationValue"));
//        readAssoValueInvocation.arguments().add(ast.newSimpleName(ParamReader));
////    readAssoValueInvocation.arguments().add(ast.newSimpleName(ParamValue));
//
//        readAssoValueInvocation.arguments().add(ast.newSimpleName(ParamSerializer));
//        fragment.setInitializer(readAssoValueInvocation);
//
//        VariableDeclarationStatement variableDeclarationStatement =
//                ast.newVariableDeclarationStatement(fragment);
//        variableDeclarationStatement.setType(hashMapType);
//        return variableDeclarationStatement;
//    }
//
//    private EnhancedForStatement getForEachStatement() {
//        EnhancedForStatement forStatement = ast.newEnhancedForStatement();
//        SingleVariableDeclaration singleVariableDeclaration = ast.newSingleVariableDeclaration();
//        singleVariableDeclaration.setName(ast.newSimpleName("dicKey"));
//        singleVariableDeclaration.setType(ast.newSimpleType(ast.newSimpleName("String")));
//        forStatement.setParameter(singleVariableDeclaration);
//
//        MethodInvocation forExpression = ast.newMethodInvocation();
//        forExpression.setName(ast.newSimpleName("keySet"));
//        forExpression.setExpression(ast.newSimpleName(DicValName));
//        forStatement.setExpression(forExpression);
//
//        Block forBody = buildForEachBody();
////    Block forBody = ast.newBlock();
////    VariableDeclarationFragment getValueFragment = ast.newVariableDeclarationFragment();
////    getValueFragment.setName(ast.newSimpleName(PropValName));
////    MethodInvocation getValueInvocation = ast.newMethodInvocation();
////    getValueInvocation.setExpression(ast.newSimpleName(DicValName));
////    getValueInvocation.setName(ast.newSimpleName("get"));
////    getValueInvocation.arguments().add(ast.newSimpleName(DicKeyValName));
////    getValueFragment.setInitializer(getValueInvocation);
////    VariableDeclarationStatement getValueStatement =
////        ast.newVariableDeclarationStatement(getValueFragment);
////    getValueStatement.setType(ast.newSimpleType(ast.newSimpleName("Object")));
////    forBody.statements().add(getValueStatement);
//
//        forStatement.setBody(forBody);
//        return forStatement;
//    }
//
//    private Block buildForEachBody() {
//        Block forBody = ast.newBlock();
//        forBody.statements().add(getPropStatement());
//
//        IfStatement baseStatement = getBaseStatement(refElement);
//        forBody.statements().add(baseStatement);
//
//        GspFieldCollection elements =
//                refElement.getChildAssociations().get(0).getRefElementCollection();
//        for (IGspCommonField refEle : elements) {
//            forBody.statements().add(getPaserStatement(refEle));
//        }
//        return forBody;
//    }
//
//    // private GspFieldCollection  getFieldCollection(IGspCommonField field)
//    // {
//    //    if (!field.getIsRefElement())
//    //        return field.getChildAssociations()[0].RefElementCollection();
//    //    var refElementId = field.getRefElementId();
//    //    var refModelId = field.ParentAssociation.getRefModelID();
//    //    var refModelPkg = field.ParentAssociation.getRefModelPkgName();
//    //    var refModel =
//    // dataTypeGenContext.coreGenContext.CefGenContext.GetMetadataContent<GspBusinessEntity>(refModelPkg, refModelId);
//    //    var refElement = refModel.FindElementById(refElementId);
//
//    //    return GetFieldCollection(refElement);
//    // }
//
//    private IGspCommonField getRefElement(IGspCommonField field) {
//        if (!field.getIsRefElement()) {
//            return field;
//        }
//
//        String refElementId = field.getRefElementId();
//
//        String refModelId = field.getParentAssociation().getRefModelID();
//
//        String refModelPkg = field.getParentAssociation().getRefModelPkgName();
//
//        GspBusinessEntity refModel =
//                dataTypeGenContext
//                        .coreGenContext
//                        .getCefGenContext()
//                        .getMetadataContent(refModelPkg, refModelId);
//
//        IGspCommonObject refObj =
//                refModel.findObjectById(field.getParentAssociation().getRefObjectID());
//
//        IGspCommonElement refElement = refObj.findElement(refElementId);
//
//        return getRefElement(refElement);
//    }
//
//    private VariableDeclarationStatement getPropStatement() {
//        VariableDeclarationFragment getValueFragment = ast.newVariableDeclarationFragment();
//        getValueFragment.setName(ast.newSimpleName(PropValName));
//        MethodInvocation getValueInvocation = ast.newMethodInvocation();
//        getValueInvocation.setExpression(ast.newSimpleName(DicValName));
//        getValueInvocation.setName(ast.newSimpleName("get"));
//        getValueInvocation.arguments().add(ast.newSimpleName(DicKeyValName));
//        getValueFragment.setInitializer(getValueInvocation);
//        VariableDeclarationStatement getValueStatement =
//                ast.newVariableDeclarationStatement(getValueFragment);
//        getValueStatement.setType(ast.newSimpleType(ast.newSimpleName("Object")));
//        return getValueStatement;
//    }
//
//    private IfStatement getBaseStatement(IGspCommonField refElement) {
//        IfStatement ifStatement = ast.newIfStatement();
//
//        InfixExpression ifConditionExpression = ast.newInfixExpression();
//        ifConditionExpression.setOperator(Operator.CONDITIONAL_OR);
//        ifConditionExpression.setLeftOperand(getDefaultValueExpression(refElement.getLabelID()));
//        ifConditionExpression.setRightOperand(
//                getDefaultValueExpression(StringUtils.toCamelCase(refElement.getLabelID())));
//        ifStatement.setExpression(ifConditionExpression);
//
//        MethodInvocation setValueInvocation = ast.newMethodInvocation();
//        setValueInvocation
//                .arguments()
//                .add(readBasicProperty(ast, element,PropValName));
//        setValueInvocation.setName(ast.newSimpleName("set" + refElement.getLabelID()));
//        setValueInvocation.setExpression(ast.newSimpleName(AssoValName));
//        ifStatement.setThenStatement(ast.newExpressionStatement(setValueInvocation));
//
//        return ifStatement;
//    }
//
//    private IfStatement getPaserStatement(IGspCommonField refElement) {
//        Expression express;
//        if (refElement.getIsUdt()) {
//            express = getUdtStatement(refElement);
//        } else {
//            express = getElementStatement(refElement);
//        }
//        IfStatement ifStatement = ast.newIfStatement();
//
//        InfixExpression ifConditionExpression = ast.newInfixExpression();
//        ifConditionExpression.setOperator(Operator.CONDITIONAL_OR);
//        ifConditionExpression.setLeftOperand(getDefaultValueExpression(refElement.getLabelID()));
//        ifConditionExpression.setRightOperand(
//                getDefaultValueExpression(StringUtils.toCamelCase(refElement.getLabelID())));
//        ifStatement.setExpression(ifConditionExpression);
//
//        MethodInvocation setValueInvocation = ast.newMethodInvocation();
//        setValueInvocation.arguments().add(express);
//        setValueInvocation.setName(ast.newSimpleName("set" + refElement.getLabelID()));
//        setValueInvocation.setExpression(ast.newSimpleName(AssoValName));
//        ifStatement.setThenStatement(ast.newExpressionStatement(setValueInvocation));
//
//        return ifStatement;
//    }
//    private MethodInvocation getDefaultValueExpression(String propName){
//       MethodInvocation methodInvocation=ast.newMethodInvocation();
//       methodInvocation.setExpression(ast.newSimpleName(DicKeyValName));
//       methodInvocation.setName(ast.newSimpleName("equals"));
//       StringLiteral stringLiteral=ast.newStringLiteral();
//       stringLiteral.setLiteralValue(propName);
//       methodInvocation.arguments().add(stringLiteral);
//       return methodInvocation;
//
//    }
//    private InfixExpression getBinaryExpression(String propName) {
//        InfixExpression infixExpression = ast.newInfixExpression();
//        infixExpression.setOperator(Operator.EQUALS);
//        infixExpression.setLeftOperand(ast.newSimpleName(DicKeyValName));
//        StringLiteral rightOperandValue = ast.newStringLiteral();
//        rightOperandValue.setLiteralValue(propName);
//        infixExpression.setRightOperand(rightOperandValue);
//        return infixExpression;
//    }
//
//    private Expression getUdtStatement(IGspCommonField refElement) {
//
//        CefGeneratorContext cefContext = dataTypeGenContext.coreGenContext.getCefGenContext();
//
//        UnifiedDataTypeDef udt =
//                cefContext.getMetadataContent(
//                        refElement.getUdtPkgName(), refElement.getUdtID());
//        if (udt == null) {
//            throw new RuntimeException("未获取到UDT" + refElement.getUdtID());
//        }
//
//        CastExpression castExpression = ast.newCastExpression();
//        TypeInfo typeInfo = Utils.getUdtType(refElement.getUdtPkgName(), refElement.getUdtID(), cefContext);
//        castExpression.setType(ast.newSimpleType(ast.newName(typeInfo.getTypeFullName())));
//
//        MethodInvocation methodInvocation = ast.newMethodInvocation();
//        methodInvocation.setName(ast.newSimpleName("getUdtEntity"));
//        methodInvocation.arguments().add(ast.newSimpleName(PropValName));
//        StringLiteral stringLiteral = ast.newStringLiteral();
//        stringLiteral.setLiteralValue(udt.getUdtType());
//        methodInvocation.arguments().add(stringLiteral);
//
//        castExpression.setExpression(methodInvocation);
//
//        return castExpression;
//    }
//
//    /// #region 普通类型关联带出字段
//
//    public Expression readBasicProperty(AST ast, IGspCommonField element, String varName) {
//        switch (element.getMDataType()) {
//            case String:
//            case Text:
////                var castExpression = ast.newCastExpression();
////                castExpression.setType(ast.newSimpleType(ast.newSimpleName("String")));
////                castExpression.setExpression(ast.newSimpleName(varName));
////                return castExpression;
//                return readStringproperty(ast,element,varName);
//            case Integer:
//                return readIntProperty(ast, element,varName);
//            case Decimal:
//               return  readBigDecimalProperty(ast,element,varName);
////                var castExpression1 = ast.newCastExpression();
////                castExpression1.setType(ast.newSimpleType(ast.newSimpleName("BigDecimal")));
////                castExpression1.setExpression(ast.newSimpleName(varName));
////                addImport(BigDecimal.class.getTypeName());
////                return castExpression1;
//            case Date:
////                return  readDateProperty(ast,element,varName);
//            case DateTime:
////                var castExpressionDate = ast.newCastExpression();
////                castExpressionDate.setType(ast.newSimpleType(ast.newSimpleName("Date")));
////                castExpressionDate.setExpression(ast.newSimpleName(varName));
////                addImport(Date.class.getTypeName());
////                return castExpressionDate;
//                return readDateTimeProperty(ast,element,varName);
//            case Boolean:
//                return readBoolProperty(ast, element, varName);
//            case Binary:
//                return readBinaryProperty(ast, element, varName);
//            default:
//                throw new RuntimeException();
//        }
//    }
//
//    private Expression readBinaryProperty(AST ast,IGspCommonField element,String varName){
//        MethodInvocation method=ast.newMethodInvocation();
//        method.setExpression(ast.newSimpleName("SerializerUtil"));
//        method.setName(ast.newSimpleName("getBinary"));
//        method.arguments().add(ast.newSimpleName(varName));
//        addImport(SerializerUtil.class.getTypeName());
//        return method;
//    }
//
//    private Expression readStringproperty(AST ast,IGspCommonField element,String varName){
//        //Integer.parseInt((String)os)
//        MethodInvocation method=ast.newMethodInvocation();
//        method.setExpression(ast.newSimpleName("SerializerUtil"));
//        method.setName(ast.newSimpleName("getString"));
//        method.arguments().add(ast.newSimpleName(varName));
//        addImport(SerializerUtil.class.getTypeName());
//        addImport(String.class.getTypeName());
//        return method;
//    }
//    private Expression readDateTimeProperty(AST ast,IGspCommonField element,String varName){
//        MethodInvocation methodInvocation=ast.newMethodInvocation();
//
//        ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation();
//        classInstanceCreation.setType(ast.newSimpleType(ast.newName("BefDateSerUtil")));
//        methodInvocation.setExpression(classInstanceCreation);
//        String readMethodName="";
//        if (SerItemGenUtil.getEnableStdDateTime(this.dataTypeGenContext)) {
//            readMethodName = "readStdDateTime";
//        } else {
//            readMethodName = "readDateTime";
//        }
//        methodInvocation.setName(ast.newSimpleName(readMethodName));
//
//        SimpleName arg=ast.newSimpleName(varName);
//        methodInvocation.arguments().add(arg);
//        addImport(BefDateSerUtil.class.getTypeName());
//        return methodInvocation;
//    }
//
//    private Expression readDateProperty(AST ast,IGspCommonField element,String varName){
//        MethodInvocation methodInvocation=ast.newMethodInvocation();
//        QualifiedName qualifiedName1=ast.newQualifiedName(ast.newSimpleName("java"),ast.newSimpleName("sql"));
//        QualifiedName qualifiedName=ast.newQualifiedName(qualifiedName1,ast.newSimpleName("Date"));
//        methodInvocation.setExpression(qualifiedName);
//        methodInvocation.setName(ast.newSimpleName("valueOf"));
//
//        MethodInvocation methodInvocation1=ast.newMethodInvocation();
//        methodInvocation1.setExpression(ast.newSimpleName(varName));
//        methodInvocation1.setName(ast.newSimpleName("toString"));
//        methodInvocation.arguments().add(methodInvocation1);
//        return methodInvocation;
//
//    }
//    private Expression readBigDecimalProperty(AST ast, IGspCommonField element,String varName){
////       MethodInvocation methodInvocation=ast.newMethodInvocation();
////       methodInvocation.setExpression(ast.newSimpleName("BigDecimal"));
////       methodInvocation.setName(ast.newSimpleName("valueOf"));
////
////       CastExpression castExpression=ast.newCastExpression();
////       castExpression.setType(ast.newSimpleType(ast.newSimpleName("Double")));
////       castExpression.setExpression(ast.newSimpleName(varName));
////        addImport(BigDecimal.class.getTypeName());
////       methodInvocation.arguments().add(castExpression);
//        SuperMethodInvocation superMethodInvocation=ast.newSuperMethodInvocation();
//        superMethodInvocation.setName(ast.newSimpleName("getDecimalValue"));
//        superMethodInvocation.arguments().add(ast.newSimpleName(varName));
//       return superMethodInvocation;
//    }
//
//    private Expression readIntProperty(AST ast, IGspCommonField element, String varName){
//        //Integer.parseInt((String)os)
//        MethodInvocation method=ast.newMethodInvocation();
//        method.setExpression(ast.newSimpleName("SerializerUtil"));
//        method.setName(ast.newSimpleName("getInteger"));
//        method.arguments().add(ast.newSimpleName(varName));
//        addImport(SerializerUtil.class.getTypeName());
//        addImport(Integer.class.getTypeName());
////        var method = ExpressionUtils.getMethodInvocation(ast, "Integer", "parseInt");
////        MethodInvocation methodInvocation1=ast.newMethodInvocation();
////        methodInvocation1.setExpression(ast.newSimpleName(varName));
////        methodInvocation1.setName(ast.newSimpleName("toString"));
////        method.arguments().add(methodInvocation1);
////        addImport(Integer.class.getTypeName());
////        var castExpression = ast.newCastExpression();
////        castExpression.setType(ast.newSimpleType(ast.newSimpleName("Integer")));
////        castExpression.setExpression(ast.newSimpleName(varName));
////        addImport(Integer.class.getTypeName());
////        var method = ExpressionUtils.getMethodInvocation(ast, "Integer", "parseInt");
////        method.arguments().add(castExpression);
////        addImport(Integer.class.getTypeName());
////        return method;
//        return method;
//    }
//
//    private Expression readBoolProperty(AST ast, IGspCommonField element, String varName){
//        //Boolean.valueOf(o.toString())
////        var castExpression = ast.newCastExpression();
////        castExpression.setType(ast.newSimpleType(ast.newSimpleName("String")));
////        castExpression.setExpression(ast.newSimpleName(varName));
////
////        var method = ExpressionUtils.getMethodInvocation(ast, "Boolean", "valueOf");
////        method.arguments().add(castExpression);
////        var castExpression = ast.newCastExpression();
////        castExpression.setType(ast.newSimpleType(ast.newSimpleName("Boolean")));
////        castExpression.setExpression(ast.newSimpleName(varName));
////        MethodInvocation methodInvocation1=ast.newMethodInvocation();
////        methodInvocation1.setExpression(ast.newSimpleName(varName));
////        methodInvocation1.setName(ast.newSimpleName("toString"));
////        var method = ExpressionUtils.getMethodInvocation(ast, "Boolean", "parseBoolean");
////        method.arguments().add(methodInvocation1);
////        addImport(Boolean.class.getTypeName());
//        MethodInvocation method=ast.newMethodInvocation();
//        method.setExpression(ast.newSimpleName("SerializerUtil"));
//        method.setName(ast.newSimpleName("getBoolean"));
//        method.arguments().add(ast.newSimpleName(varName));
//        addImport(SerializerUtil.class.getTypeName());
//        addImport(Boolean.class.getTypeName());
//        return method;
//    }
//    private Expression getElementStatement(IGspCommonField refElement) {
//        Expression statement = null;
//        switch (refElement.getObjectType()) {
//            case None:
//                statement = readBasicProperty(ast, refElement,PropValName);
//                break;
//            case Association:
//                String methodName =
//                        dataTypeGenContext.getAssociationReadMetdNames().get(refElement.getLabelID());
//                IGspCommonField refEle = getRefElement(refElement);
//                TypeInfo assTypeSyntax =
//                        Utils.getRefElementTypeSyntax(
//                                dataTypeGenContext.coreGenContext.getCefGenContext(), refEle);
//                Expression assoStatement = getNestedAssoElementValue(ast, methodName);
//                CastExpression castExpression = ast.newCastExpression();
//                castExpression.setType(assTypeSyntax.getType(ast));
//                castExpression.setExpression(assoStatement);
//                statement = castExpression;
//                break;
//            case Enum:
//                statement = readEnumProperty(refElement);
//                break;
//            default:
//                throw new RuntimeException();
//        }
//        return statement;
//    }
//
//    private Expression getNestedAssoElementValue(AST ast, String assoMethodName){
//        // new TreeTraversingParser((JsonNode)propertyValue)
//        addImport(TreeTraversingParser.class.getTypeName());
//        addImport(JsonNode.class.getTypeName());
//
//        ClassInstanceCreation classInstanceCreation = ast.newClassInstanceCreation();
//        classInstanceCreation.setType(new TypeInfo(TreeTraversingParser.class).getType(ast));
//        CastExpression castJsonNode = ast.newCastExpression();
//        castJsonNode.setType(new TypeInfo(JsonNode.class).getType(ast));
//        castJsonNode.setExpression(ast.newSimpleName(PropValName));
//        classInstanceCreation.arguments().add(castJsonNode);
//        MethodInvocation readAssoInvocation = ast.newMethodInvocation();
//        readAssoInvocation.setName(ast.newSimpleName(assoMethodName));
//        readAssoInvocation.arguments().add(classInstanceCreation);
//        readAssoInvocation.arguments().add(ast.newSimpleName(ParamSerializer));
//        return readAssoInvocation;
//    }
//
//    private MethodInvocation readEnumProperty(IGspCommonField element) {
//        MethodInvocation methodInvocation = ast.newMethodInvocation();
//        methodInvocation.setName(ast.newSimpleName(CMChangeJsonConvertorGenUtils.mName_ReadEnum));
//        methodInvocation.arguments().add(ast.newSimpleName(PropValName));
//        TypeInfo assTypeSyntax = Utils.getRefElementPropertyName(
//            element,
//            element.getParentAssociation(),
//            dataTypeGenContext.coreGenContext.getCefGenContext());
////        TypeInfo assTypeSyntax = new TypeInfo(SerItemGenUtil.getEnumTypeName(element));
////        assTypeSyntax.setTypePackageName(
////            element.getBelongObject().getGeneratedEntityClassInfo().getClassNamespace());
//
//
//        TypeLiteral typeLiteral = ast.newTypeLiteral();
//        typeLiteral.setType(ast.newSimpleType(ast.newName(assTypeSyntax.getTypeFullName())));
//        methodInvocation.arguments().add(typeLiteral);
//
//        return methodInvocation;
//    }
//
//    // endregion
//}
